/**
 * This is a generated class and is not intended for modification.  To customize behavior
 * of this value object you may modify the generated sub-class of this class - RemoteIssue.as.
 */

package valueObjects
{
import com.adobe.fiber.services.IFiberManagingService;
import com.adobe.fiber.valueobjects.IValueObject;
import flash.events.EventDispatcher;
import mx.collections.ArrayCollection;
import mx.events.PropertyChangeEvent;
import valueObjects.RemoteComponent;
import valueObjects.RemoteCustomFieldValue;
import valueObjects.RemoteVersion;

import flash.net.registerClassAlias;
import flash.net.getClassByAlias;
import com.adobe.fiber.core.model_internal;
import com.adobe.fiber.valueobjects.IPropertyIterator;
import com.adobe.fiber.valueobjects.AvailablePropertyIterator;

use namespace model_internal;

[ExcludeClass]
public class _Super_RemoteIssue extends flash.events.EventDispatcher implements com.adobe.fiber.valueobjects.IValueObject
{
    model_internal static function initRemoteClassAliasSingle(cz:Class) : void
    {
    }

    model_internal static function initRemoteClassAliasAllRelated() : void
    {
        valueObjects.RemoteVersion.initRemoteClassAliasSingleChild();
        valueObjects.RemoteComponent.initRemoteClassAliasSingleChild();
        valueObjects.RemoteCustomFieldValue.initRemoteClassAliasSingleChild();
    }

    model_internal var _dminternal_model : _RemoteIssueEntityMetadata;
    model_internal var _changedObjects:mx.collections.ArrayCollection = new ArrayCollection();

    public function getChangedObjects() : Array
    {
        _changedObjects.addItemAt(this,0);
        return _changedObjects.source;
    }

    public function clearChangedObjects() : void
    {
        _changedObjects.removeAll();
    }

    /**
     * properties
     */
    private var _internal_id : String;
    private var _internal_affectsVersions : ArrayCollection;
    model_internal var _internal_affectsVersions_leaf:valueObjects.RemoteVersion;
    private var _internal_assignee : String;
    private var _internal_attachmentNames : ArrayCollection;
    private var _internal_components : ArrayCollection;
    model_internal var _internal_components_leaf:valueObjects.RemoteComponent;
    private var _internal_created : Date;
    private var _internal_customFieldValues : ArrayCollection;
    model_internal var _internal_customFieldValues_leaf:valueObjects.RemoteCustomFieldValue;
    private var _internal_description : String;
    private var _internal_duedate : Date;
    private var _internal_environment : String;
    private var _internal_fixVersions : ArrayCollection;
    model_internal var _internal_fixVersions_leaf:valueObjects.RemoteVersion;
    private var _internal_key : String;
    private var _internal_priority : String;
    private var _internal_project : String;
    private var _internal_reporter : String;
    private var _internal_resolution : String;
    private var _internal_status : String;
    private var _internal_summary : String;
    private var _internal_type : String;
    private var _internal_updated : Date;
    private var _internal_votes : Number;

    private static var emptyArray:Array = new Array();


    /**
     * derived property cache initialization
     */
    model_internal var _cacheInitialized_isValid:Boolean = false;

    model_internal var _changeWatcherArray:Array = new Array();

    public function _Super_RemoteIssue()
    {
        _model = new _RemoteIssueEntityMetadata(this);

        // Bind to own data or source properties for cache invalidation triggering

    }

    /**
     * data/source property getters
     */

    [Bindable(event="propertyChange")]
    public function get id() : String
    {
        return _internal_id;
    }

    [Bindable(event="propertyChange")]
    public function get affectsVersions() : ArrayCollection
    {
        return _internal_affectsVersions;
    }

    [Bindable(event="propertyChange")]
    public function get assignee() : String
    {
        return _internal_assignee;
    }

    [Bindable(event="propertyChange")]
    public function get attachmentNames() : ArrayCollection
    {
        return _internal_attachmentNames;
    }

    [Bindable(event="propertyChange")]
    public function get components() : ArrayCollection
    {
        return _internal_components;
    }

    [Bindable(event="propertyChange")]
    public function get created() : Date
    {
        return _internal_created;
    }

    [Bindable(event="propertyChange")]
    public function get customFieldValues() : ArrayCollection
    {
        return _internal_customFieldValues;
    }

    [Bindable(event="propertyChange")]
    public function get description() : String
    {
        return _internal_description;
    }

    [Bindable(event="propertyChange")]
    public function get duedate() : Date
    {
        return _internal_duedate;
    }

    [Bindable(event="propertyChange")]
    public function get environment() : String
    {
        return _internal_environment;
    }

    [Bindable(event="propertyChange")]
    public function get fixVersions() : ArrayCollection
    {
        return _internal_fixVersions;
    }

    [Bindable(event="propertyChange")]
    public function get key() : String
    {
        return _internal_key;
    }

    [Bindable(event="propertyChange")]
    public function get priority() : String
    {
        return _internal_priority;
    }

    [Bindable(event="propertyChange")]
    public function get project() : String
    {
        return _internal_project;
    }

    [Bindable(event="propertyChange")]
    public function get reporter() : String
    {
        return _internal_reporter;
    }

    [Bindable(event="propertyChange")]
    public function get resolution() : String
    {
        return _internal_resolution;
    }

    [Bindable(event="propertyChange")]
    public function get status() : String
    {
        return _internal_status;
    }

    [Bindable(event="propertyChange")]
    public function get summary() : String
    {
        return _internal_summary;
    }

    [Bindable(event="propertyChange")]
    public function get type() : String
    {
        return _internal_type;
    }

    [Bindable(event="propertyChange")]
    public function get updated() : Date
    {
        return _internal_updated;
    }

    [Bindable(event="propertyChange")]
    public function get votes() : Number
    {
        return _internal_votes;
    }

    public function clearAssociations() : void
    {
    }

    /**
     * data/source property setters
     */

    public function set id(value:String) : void
    {
        var oldValue:String = _internal_id;
        if (oldValue !== value)
        {
            _internal_id = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "id", oldValue, _internal_id));
        }
    }

    public function set affectsVersions(value:*) : void
    {
        var oldValue:ArrayCollection = _internal_affectsVersions;
        if (oldValue !== value)
        {
            if (value is ArrayCollection)
            {
                _internal_affectsVersions = value;
            }
            else if (value is Array)
            {
                _internal_affectsVersions = new ArrayCollection(value);
            }
            else if (value == null)
            {
                _internal_affectsVersions = null;
            }
            else
            {
                throw new Error("value of affectsVersions must be a collection");
            }
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "affectsVersions", oldValue, _internal_affectsVersions));
        }
    }

    public function set assignee(value:String) : void
    {
        var oldValue:String = _internal_assignee;
        if (oldValue !== value)
        {
            _internal_assignee = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "assignee", oldValue, _internal_assignee));
        }
    }

    public function set attachmentNames(value:*) : void
    {
        var oldValue:ArrayCollection = _internal_attachmentNames;
        if (oldValue !== value)
        {
            if (value is ArrayCollection)
            {
                _internal_attachmentNames = value;
            }
            else if (value is Array)
            {
                _internal_attachmentNames = new ArrayCollection(value);
            }
            else if (value == null)
            {
                _internal_attachmentNames = null;
            }
            else
            {
                throw new Error("value of attachmentNames must be a collection");
            }
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "attachmentNames", oldValue, _internal_attachmentNames));
        }
    }

    public function set components(value:*) : void
    {
        var oldValue:ArrayCollection = _internal_components;
        if (oldValue !== value)
        {
            if (value is ArrayCollection)
            {
                _internal_components = value;
            }
            else if (value is Array)
            {
                _internal_components = new ArrayCollection(value);
            }
            else if (value == null)
            {
                _internal_components = null;
            }
            else
            {
                throw new Error("value of components must be a collection");
            }
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "components", oldValue, _internal_components));
        }
    }

    public function set created(value:Date) : void
    {
        var oldValue:Date = _internal_created;
        if (oldValue !== value)
        {
            _internal_created = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "created", oldValue, _internal_created));
        }
    }

    public function set customFieldValues(value:*) : void
    {
        var oldValue:ArrayCollection = _internal_customFieldValues;
        if (oldValue !== value)
        {
            if (value is ArrayCollection)
            {
                _internal_customFieldValues = value;
            }
            else if (value is Array)
            {
                _internal_customFieldValues = new ArrayCollection(value);
            }
            else if (value == null)
            {
                _internal_customFieldValues = null;
            }
            else
            {
                throw new Error("value of customFieldValues must be a collection");
            }
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "customFieldValues", oldValue, _internal_customFieldValues));
        }
    }

    public function set description(value:String) : void
    {
        var oldValue:String = _internal_description;
        if (oldValue !== value)
        {
            _internal_description = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "description", oldValue, _internal_description));
        }
    }

    public function set duedate(value:Date) : void
    {
        var oldValue:Date = _internal_duedate;
        if (oldValue !== value)
        {
            _internal_duedate = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "duedate", oldValue, _internal_duedate));
        }
    }

    public function set environment(value:String) : void
    {
        var oldValue:String = _internal_environment;
        if (oldValue !== value)
        {
            _internal_environment = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "environment", oldValue, _internal_environment));
        }
    }

    public function set fixVersions(value:*) : void
    {
        var oldValue:ArrayCollection = _internal_fixVersions;
        if (oldValue !== value)
        {
            if (value is ArrayCollection)
            {
                _internal_fixVersions = value;
            }
            else if (value is Array)
            {
                _internal_fixVersions = new ArrayCollection(value);
            }
            else if (value == null)
            {
                _internal_fixVersions = null;
            }
            else
            {
                throw new Error("value of fixVersions must be a collection");
            }
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "fixVersions", oldValue, _internal_fixVersions));
        }
    }

    public function set key(value:String) : void
    {
        var oldValue:String = _internal_key;
        if (oldValue !== value)
        {
            _internal_key = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "key", oldValue, _internal_key));
        }
    }

    public function set priority(value:String) : void
    {
        var oldValue:String = _internal_priority;
        if (oldValue !== value)
        {
            _internal_priority = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "priority", oldValue, _internal_priority));
        }
    }

    public function set project(value:String) : void
    {
        var oldValue:String = _internal_project;
        if (oldValue !== value)
        {
            _internal_project = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "project", oldValue, _internal_project));
        }
    }

    public function set reporter(value:String) : void
    {
        var oldValue:String = _internal_reporter;
        if (oldValue !== value)
        {
            _internal_reporter = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "reporter", oldValue, _internal_reporter));
        }
    }

    public function set resolution(value:String) : void
    {
        var oldValue:String = _internal_resolution;
        if (oldValue !== value)
        {
            _internal_resolution = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "resolution", oldValue, _internal_resolution));
        }
    }

    public function set status(value:String) : void
    {
        var oldValue:String = _internal_status;
        if (oldValue !== value)
        {
            _internal_status = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "status", oldValue, _internal_status));
        }
    }

    public function set summary(value:String) : void
    {
        var oldValue:String = _internal_summary;
        if (oldValue !== value)
        {
            _internal_summary = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "summary", oldValue, _internal_summary));
        }
    }

    public function set type(value:String) : void
    {
        var oldValue:String = _internal_type;
        if (oldValue !== value)
        {
            _internal_type = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "type", oldValue, _internal_type));
        }
    }

    public function set updated(value:Date) : void
    {
        var oldValue:Date = _internal_updated;
        if (oldValue !== value)
        {
            _internal_updated = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "updated", oldValue, _internal_updated));
        }
    }

    public function set votes(value:Number) : void
    {
        var oldValue:Number = _internal_votes;
        if (oldValue !== value)
        {
            _internal_votes = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "votes", oldValue, _internal_votes));
        }
    }

    /**
     * Data/source property setter listeners
     *
     * Each data property whose value affects other properties or the validity of the entity
     * needs to invalidate all previously calculated artifacts. These include:
     *  - any derived properties or constraints that reference the given data property.
     *  - any availability guards (variant expressions) that reference the given data property.
     *  - any style validations, message tokens or guards that reference the given data property.
     *  - the validity of the property (and the containing entity) if the given data property has a length restriction.
     *  - the validity of the property (and the containing entity) if the given data property is required.
     */


    /**
     * valid related derived properties
     */
    model_internal var _isValid : Boolean;
    model_internal var _invalidConstraints:Array = new Array();
    model_internal var _validationFailureMessages:Array = new Array();

    /**
     * derived property calculators
     */

    /**
     * isValid calculator
     */
    model_internal function calculateIsValid():Boolean
    {
        var violatedConsts:Array = new Array();
        var validationFailureMessages:Array = new Array();

        var propertyValidity:Boolean = true;

        model_internal::_cacheInitialized_isValid = true;
        model_internal::invalidConstraints_der = violatedConsts;
        model_internal::validationFailureMessages_der = validationFailureMessages;
        return violatedConsts.length == 0 && propertyValidity;
    }

    /**
     * derived property setters
     */

    model_internal function set isValid_der(value:Boolean) : void
    {
        var oldValue:Boolean = model_internal::_isValid;
        if (oldValue !== value)
        {
            model_internal::_isValid = value;
            _model.model_internal::fireChangeEvent("isValid", oldValue, model_internal::_isValid);
        }
    }

    /**
     * derived property getters
     */

    [Transient]
    [Bindable(event="propertyChange")]
    public function get _model() : _RemoteIssueEntityMetadata
    {
        return model_internal::_dminternal_model;
    }

    public function set _model(value : _RemoteIssueEntityMetadata) : void
    {
        var oldValue : _RemoteIssueEntityMetadata = model_internal::_dminternal_model;
        if (oldValue !== value)
        {
            model_internal::_dminternal_model = value;
            this.dispatchEvent(mx.events.PropertyChangeEvent.createUpdateEvent(this, "_model", oldValue, model_internal::_dminternal_model));
        }
    }

    /**
     * methods
     */


    /**
     *  services
     */
    private var _managingService:com.adobe.fiber.services.IFiberManagingService;

    public function set managingService(managingService:com.adobe.fiber.services.IFiberManagingService):void
    {
        _managingService = managingService;
    }

    model_internal function set invalidConstraints_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_invalidConstraints;
        // avoid firing the event when old and new value are different empty arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_invalidConstraints = value;
            _model.model_internal::fireChangeEvent("invalidConstraints", oldValue, model_internal::_invalidConstraints);
        }
    }

    model_internal function set validationFailureMessages_der(value:Array) : void
    {
        var oldValue:Array = model_internal::_validationFailureMessages;
        // avoid firing the event when old and new value are different empty arrays
        if (oldValue !== value && (oldValue.length > 0 || value.length > 0))
        {
            model_internal::_validationFailureMessages = value;
            _model.model_internal::fireChangeEvent("validationFailureMessages", oldValue, model_internal::_validationFailureMessages);
        }
    }


}

}
